<template>
	<view class="">
		<view class="banner">
			<image src="../../static/images/6_02.jpg" class="off-images" mode="widthFix"></image>
		</view>
		<view class="wrap">
			<view class="off" v-for="item in resData" @click="open" :data-aid="item.cid" :data-isopen="item.is_open">
				<view class="off-img">
					<image :src="item.thumb" class="off-image"></image>
				</view>
				<view class="off-info">
					<view class="off-name">{{item.title}}</view>
					<view class="off-time">活动时间：{{item.starttime}} 至 {{item.endtime}}</view>
				</view>
			</view>
		</view>
		
		
		<view class="btn-margin" :style="'padding-bottom: '+buBottom+'rpx'"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				buBottom: 0,
				options: '',
				resData: ''
			}
		},
		/**
		 * 生命周期函数--点击事件集合
		 */
		methods: {
			get_init(){
				var catid = this.options.catid
				var post_data = {catid:catid}
				
				this.$http({
					url: 'Api/Offer/more_page',
					data: post_data,
					hideLoading: true,
					success: res => {
						if(res.code == 1){
							this.resData = res.data
						}
					}
				})
			},
			open(e){
				var is_open = e.currentTarget.dataset.isopen
				if(is_open){
					var aid = e.currentTarget.dataset.aid
					uni.navigateTo({
						url: '/pages/activity/index?aid='+aid
					})
				}
			}
		},
		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad(options) {
			this.options = options
			this.get_init()
		},

		/**
		 * 生命周期函数--监听页面初次渲染完成
		 */
		onReady() {

		},

		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow() {

		},

		/**
		 * 生命周期函数--监听页面隐藏
		 */
		onHide() {

		},

		/**
		 * 生命周期函数--监听页面卸载
		 */
		onUnload() {

		},

		/**
		 * 页面相关事件处理函数--监听用户下拉动作
		 */
		onPullDownRefresh() {

		},

		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom() {

		}
	}
</script>

<style scoped>
	.wrap {
		padding: 30rpx;
	}
	
	.banner{
		padding: 0rpx;
	}

	.off {
		box-shadow: 0 10rpx 10rpx rgba(0, 0, 0, .1);
		margin-bottom: 20rpx;
	}

	.off-image {
		height: 240rpx;
	}
	
	.off-images{
		width: 100%;
	}

	.off-info {
		padding: 20rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		height: 180rpx;
		border: 1px #e6e6e6 solid;
		border-top: none;
	}

	.off-name {
		font-weight: bold;
		font-size: 30rpx;
		color: #333;
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.off-time {
		font-size: 24rpx;
		color: #4c4c4c;
	}
</style>
